package cn.devzyh.oms.coms.api.flow.feign;

import cn.devzyh.oms.common.core.constant.SecurityConstants;
import cn.devzyh.oms.common.core.constant.ServiceNameConstants;
import cn.devzyh.oms.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.Map;

/**
 * 工作流操作
 *
 * @author devzyh
 * @date 2024-03-07
 */
@FeignClient(contextId = "remoteFlowService", value = ServiceNameConstants.COMS_SERVICE)
public interface RemoteFlowService {

	/**
	 * 测试流程
	 *
	 * @param flowId 流程ID
	 * @return R
	 */
	@PostMapping("/flow/test/{flowId}")
	public R test(@PathVariable Long flowId, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 流程执行
	 *
	 * @param flowId 流程ID
	 * @return R
	 */
	@PostMapping("/flow/run/{flowId}")
	R run(@PathVariable Long flowId, @RequestBody Map<String, Object> params, @RequestHeader(SecurityConstants.FROM) String from);

}
